package com.zr.daoImpl;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.zr.dao.MenuDao;
import com.zr.entity.Menu;
import com.zr.utils.DBUtils;
import com.zr.utils.SystemFlag;

public class MenuDaoImpl extends DBUtils implements MenuDao {

	@Override
	public List<Object> queryAll(int eid) throws Exception {
		String sql = "select * from menu m inner join emenu e on m.id=e.mid where status=? and e.eid=?";
		Object [] objs = {SystemFlag.STATUS_OK,eid};
		ResultSet rs =query(sql,objs);
		List<Object> mlist = new ArrayList<Object>();
		while(rs.next()) {
			Menu m = new Menu(rs.getInt("id"),rs.getString("text"),rs.getString("url"));
			mlist.add(m);
		}
//		System.out.println(mlist);
		return mlist;
	}

}
